Skip to content

feat(vscode): regenerate local.settings.json, host.json, and workflow-designtime for source-controlled Logic App projects#9377

Merged
lambrianmsft merged 19 commits into
Azure:mainfrom
lambrianmsft:lambrianmsft/localsettings_regeneration
Jul 11, 2026
Merged

feat(vscode): regenerate local.settings.json, host.json, and workflow-designtime for source-controlled Logic App projects#9377
lambrianmsft merged 19 commits into
Azure:mainfrom
lambrianmsft:lambrianmsft/localsettings_regeneration

Conversation

@lambrianmsft

Copy link
Copy Markdown
Contributor

Commit Type

  • feature - New functionality
  • fix - Bug fix
  • refactor - Code restructuring without behavior change
  • perf - Performance improvement
  • docs - Documentation update
  • test - Test-related changes
  • chore - Maintenance/tooling

Risk Level

  • Low - Minor changes, limited scope
  • Medium - Moderate changes, some user impact
  • High - Major changes, significant user/system impact

What & Why

TL;DR: When a Logic App project has source control enabled, the git-ignored artifacts — the project-root local.settings.json and the workflow-designtime/ folder (and, when missing, the root host.json) — are absent on a fresh clone, leaving the project in an invalid state that can't start the design-time API.

This PR detects those missing/invalid artifacts and regenerates them from the existing project inputs (the logic app, parameters.json, and connections.json) so the project becomes valid again without manual setup. Regeneration is idempotent: valid existing files are preserved and only missing/invalid ones are rewritten. It covers both codeless and codeful logic app types, aligns the regenerated root local.settings.json key order with the creation path, and validates the workflow-designtime contents (regenerating when required keys are missing or empty). Diagnostic logging was added at each decision point to make regeneration behavior observable in the output channel.

Impact of Change

  • Users: Source-controlled Logic App projects that were missing local.settings.json / workflow-designtime (and root host.json) now self-heal on activation/design-time start, so the project is valid and the designer works without manual regeneration.
  • Developers: New exported helpers in validateProjectArtifacts.ts (regenerateLocalSettings, regenerateRootHostFile, regenerateDesignTimeDirectory, validateDesignTimeDirectory, validateAndRegenerateProjectArtifacts) wired into startDesignTimeApi / promptStartDesignTimeOption. Regeneration reuses the same content baselines as the workspace creation path.
  • System: Regeneration only writes when a file is missing or invalid; valid artifacts are left untouched (no redundant writes). No changes to workflow serialization, the designer runtime, or public package APIs.

Test Plan

  • Unit tests added/updated
  • E2E tests added/updated
  • Manual testing completed
  • Tested in:

Unit tests (apps/vs-code-designer, Vitest):

  • validateProjectArtifacts.test.ts — 27 tests. Characterizes the exact content of root and design-time local.settings.json and host.json for both codeless and codeful logic apps (locking pre-change behavior against regression), plus covers validateDesignTimeDirectory invalid-settings cases and the validateAndRegenerateProjectArtifacts orchestrator (all-missing regenerates all three artifacts; all-valid writes nothing; only-root-host-missing regenerates just root host.json).
  • startDesignTimeApi.test.ts — 18 tests, including the promptStartDesignTimeOption activation wiring (regenerates per detected folder; logs and skips when no logic app folders / no workspace folders).
  • Combined: 45 tests passing; Biome clean.

Manual testing: Verified on a source-controlled project with local.settings.json, workflow-designtime/, and root host.json removed — all regenerated with correct content and stable key order on design-time start. Also verified connection-key regeneration produces valid keys.

Contributors

Screenshots/Videos

Not applicable — no visual/UI changes. This is an activation-path artifact-regeneration change with unit coverage in apps/vs-code-designer/src/app/utils/codeless/__test__/.

Copilot AI review requested due to automatic review settings July 8, 2026 23:24
@lambrianmsft lambrianmsft added the risk:medium Medium risk change with potential impact label Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds “self-healing” for source-controlled Logic App projects in the VS Code designer by validating and regenerating git-ignored/missing artifacts needed to start the design-time API (project-root local.settings.json, project-root host.json when invalid/missing, and the workflow-designtime/ baseline).

Changes:

  • Added validateProjectArtifacts.ts helpers to validate/regenerate root host.json, root local.settings.json (including referenced @appsetting(...) keys), and workflow-designtime/ contents.
  • Wired artifact validation/regeneration into startDesignTimeApi and activation (promptStartDesignTimeOption) with additional diagnostic logging.
  • Added/updated unit tests to lock down expected artifact content and regeneration behavior.

Reviewed changes

Copilot reviewed 13 out of 23 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
libs/vscode-extension/src/graphify-out/GRAPH_REPORT.md Regenerated Graphify report output.
libs/data-mapper-v2/src/graphify-out/GRAPH_REPORT.md Regenerated Graphify report output.
libs/chatbot/src/graphify-out/graph.json Regenerated Graphify graph JSON output.
libs/chatbot/src/graphify-out/GRAPH_REPORT.md Regenerated Graphify report output.
libs/a2a-core/src/graphify-out/GRAPH_REPORT.md Regenerated Graphify report output.
apps/vs-code-designer/src/app/utils/codeless/validateProjectArtifacts.ts New artifact validation/regeneration implementation.
apps/vs-code-designer/src/app/utils/codeless/startDesignTimeApi.ts Uses the new orchestrator for design-time startup + activation-time regeneration.
apps/vs-code-designer/src/app/utils/codeless/test/validateProjectArtifacts.test.ts New unit tests covering regeneration + golden content assertions.
apps/vs-code-designer/src/app/utils/codeless/test/startDesignTimeApi.test.ts Updated tests for startup + added activation wiring tests.
apps/vs-code-designer/src/app/utils/appSettings/localSettings.ts Adjusted schema generation (including key ordering and codeful flag).
apps/vs-code-designer/src/app/utils/appSettings/test/localSettings.test.ts Added golden tests + key-order characterization coverage.
apps/vs-code-designer/src/app/commands/createNewCodeProject/CodeProjectBase/test/CreateLogicAppWorkspace.test.ts Expanded coverage for codeful local.settings.json creation expectations.

Comment thread apps/vs-code-designer/src/app/utils/appSettings/localSettings.ts Outdated
Comment thread apps/vs-code-designer/src/app/utils/codeless/validateProjectArtifacts.ts Outdated
Comment thread apps/vs-code-designer/src/app/utils/codeless/validateProjectArtifacts.ts Outdated
Comment thread apps/vs-code-designer/src/app/utils/appSettings/localSettings.ts Outdated
Comment thread apps/vs-code-designer/src/app/utils/appSettings/localSettings.ts
Comment thread apps/vs-code-designer/src/app/utils/codeless/startDesignTimeApi.ts Outdated
Comment thread apps/vs-code-designer/src/app/utils/codeless/startDesignTimeApi.ts
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🤖 AI PR Validation Report

PR Review Results

Thank you for your submission! Here's detailed feedback on your PR title and body compliance:

PR Title

  • Current: feat(vscode): regenerate local.settings.json, host.json, and workflow-designtime for source-controlled Logic App projects
  • Issue: None — the title is specific and clearly describes the change.
  • Recommendation: No change needed.

Commit Type

  • Properly selected (feature).
  • Only one commit type is selected, which is correct.

Risk Level

  • The selected risk level (Medium) matches the change scope reasonably well.
  • Advised risk level from diff: medium.

What & Why

  • Current: Well-written and specific; explains the missing git-ignored artifacts, the regeneration behavior, and the design-time impact.
  • Issue: None.
  • Recommendation: No change needed.

Impact of Change

  • The impact section is detailed and appropriately covers users, developers, and system behavior.
  • Recommendation:
    • Users: Good as written.
    • Developers: Good as written.
    • System: Good as written.

Test Plan

  • Unit tests are clearly added/updated in the diff, which satisfies the test-plan requirement.
  • Manual testing is also documented, and the absence of E2E tests is acceptable because unit tests are present.

Contributors

  • Contributor entries are present and clear.
  • Recommendation: No change needed.

Screenshots/Videos

  • Correctly marked as not applicable for a non-visual change.
  • Recommendation: No change needed.

Summary Table

Section Status Recommendation
Title No changes needed
Commit Type No changes needed
Risk Level No changes needed
What & Why No changes needed
Impact of Change No changes needed
Test Plan No changes needed
Contributors No changes needed
Screenshots/Videos No changes needed

This PR passes. The submitted risk level matches the diff-based advised risk level, so no escalation is needed.


Last updated: Fri, 10 Jul 2026 23:45:21 GMT

lambrianmsft and others added 14 commits July 9, 2026 12:21
…t for logic app types

Add golden/characterization coverage that pins the exact content of the
project-root and workflow-designtime local.settings.json schemas
(getLocalSettingsSchema) across the codeless/codeful axis, plus the codeful
creation path in CreateLogicAppWorkspace. Expected values are reconstructed
from the shared key/value constants so structural regressions are caught while
staying in sync with the codebase. These tests exercise pre-existing behavior
(source unchanged from main) and lock it in before the regeneration feature.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…for source-controlled projects

When source control is enabled, the project-root local.settings.json and the
workflow-designtime folder are gitignored, so a fresh clone lacks them and the
design-time host cannot start. Add validateProjectArtifacts to detect and
regenerate these artifacts:

- Scan connections.json, parameters.json and workflows for @appsetting('X')
  references and ensure the root local.settings.json has the baseline schema
  plus placeholder entries for every referenced key (never overwriting values).
- Validate the workflow-designtime folder (host.json + local.settings.json) and
  regenerate it when missing or invalid.

Wired into startDesignTimeApi so artifacts are validated/regenerated before the
host launches. Covered by validateProjectArtifacts.test.ts (incl. golden content
by logic app type, reconstructed from shared constants) and updated
startDesignTimeApi tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…h creation path

getLocalSettingsSchema built the root (non-design-time) Values in a different
key order than CreateLogicAppWorkspace.createLocalConfigurationFiles, so a
regenerated local.settings.json was key-for-key reordered versus a freshly
created project (e.g. APP_KIND/FUNCTIONS_WORKER_RUNTIME first instead of
AzureWebJobsStorage first). Reorder the root branch to mirror the creation path
(AzureWebJobsStorage, FUNCTIONS_INPROC_NET8_ENABLED, FUNCTIONS_WORKER_RUNTIME,
APP_KIND, ProjectDirectoryPath, [WORKFLOW_CODEFUL_ENABLED]); design-time order
is unchanged. Add key-order regression tests (toEqual ignores property order).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…esign-time dir

Add a regression test for the codeful branch where workflow-designtime already
exists but its host.json and local.settings.json are invalid (wrong bundle id /
missing required keys). Verifies both artifacts are rewritten to the codeful
baseline (host.json + local.settings.json incl. WORKFLOW_CODEFUL_ENABLED),
closing the gap where only the missing-directory codeful path was covered.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d projects

The regeneration feature restored the root local.settings.json and the workflow-designtime folder, but never regenerated the project-level host.json. When source control strips this git-ignored file from a fresh clone the function host cannot start.

Add regenerateRootHostFile (mirroring the workspace creation path host.json content) and wire it into validateAndRegenerateProjectArtifacts and promptStartDesignTimeOption. Rename isDesignTimeHostFileValid to isHostFileValid since it now validates both the root and design-time host.json.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds output-channel logging at every decision point in the host.json / local.settings.json regeneration flow: which files are checked and whether they exist, whether each file was regenerated or preserved, and how many logic app folders were detected. Crucially logs when zero logic app folders are detected, which happens when host.json is missing (a folder is only recognized as a logic app when host.json exists), explaining why regeneration appears to do nothing in that case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…r, design-time settings validation, and promptStartDesignTimeOption regeneration

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…er logic app type

Locks current regenerateLocalSettings output for logicApp/customCode/rulesEngine/codeful before refactoring. Documents the known gaps (customCode/rulesEngine undetected at regen time; codeful missing AzureWebJobsFeatureFlags) so upcoming fixes surface as intentional test diffs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ion and regeneration

Extract getRootLocalSettings(logicAppFolderPath, logicAppType) as the single source of truth for the project-root local.settings.json. Both createLocalConfigurationFiles (fresh project creation) and regenerateLocalSettings (source-control regeneration) now build the file from it, so a regenerated file is key-for-key identical to a freshly created project of the same type.

Regeneration already detects codeful via isCodefulProject, so codeful projects now regenerate with AzureWebJobsFeatureFlags in addition to WORKFLOW_CODEFUL_ENABLED, matching fresh creation. Also drops AzureFunctionsJobHost__extensionBundle__id from the codeful creation path per review feedback (codeful bundle id is not yet published).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ettings

Add detectLogicAppProjectType, which infers a source-controlled project's ProjectType from its files: codeful via isCodefulProject, and customCode/rulesEngine via a sibling custom-code functions (.csproj) project in the workspace root. regenerateLocalSettings now uses it so customCode and rulesEngine projects regenerate with AzureWebJobsFeatureFlags=EnableMultiLanguageWorker, matching what fresh creation would produce (previously they were treated as plain codeless).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…gn-time discovery mode

isHostFileValid now requires a non-empty extensionBundle.version, and for the
design-time host.json additionally requires the workflow operation discovery host
mode setting. Extract the setting key into a shared constant.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… directory

ensureDesignTimeDirectory previously used projectPath.includes(designTimeDirectoryName),
which false-positives on siblings such as workflow-designtime-backup. Match on a full
path segment instead so a backup folder gets a nested workflow-designtime directory.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…eneration

Trim inline comments that restated the validateAndRegenerateProjectArtifacts,
regenerateRootHostFile and regenerateLocalSettings docstrings, and remove a
duplicated golden-test comment line. No behavior change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rebase onto main picked up upstream's renames of the codeful constant
(workflowCodefulEnabled -> workflowCodefulEnabledKey) and SDK-detection
helper (isCodefulProject -> hasCodefulSdkReference). Update the artifact
regeneration module and its tests to use the current symbol names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lambrianmsft lambrianmsft force-pushed the lambrianmsft/localsettings_regeneration branch from 91e4b3a to 1f87218 Compare July 9, 2026 19:32
lambrianmsft and others added 5 commits July 10, 2026 09:22
Consolidate the two local.settings.json builders into a single
ProjectType-aware function. getLocalSettingsSchema's third parameter
changes from an isCodeful boolean to a ProjectType, so the root branch
now emits the multi-language worker feature flag for non-plain types
(matching the creation path) instead of only WORKFLOW_CODEFUL_ENABLED.
Creation, design-time API startup, and regeneration all route through
the one function so the files cannot drift apart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
isLogicAppProject now keys off the workflow-folder signal (codeless workflow.json with a Microsoft.Logic schema, codeful workflow.cs at the project root, or the isCodeful workspace setting) instead of requiring host.json to exist and parse.

host.json is a generic Azure Functions artifact and is commonly gitignored under source control, so a fresh clone can be missing or have a corrupted host.json yet still be a valid logic app project. Keying off the workflow signal lets the extension detect such projects and heal/regenerate host.json, local.settings.json, and workflow-designtime before starting. Also fixes codeful detection to look for workflow.cs at the project root rather than in subfolders.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…roj SDK reference

isLogicAppProject now recognizes a codeful project through hasCodefulSdkReference
(a .NET 8 .csproj referencing Microsoft.Azure.Workflows.Sdk) instead of a hardcoded
workflow.cs filename, so codeful workflows whose C# file is named anything are still
recognized. Adds a statSync default to the fs-extra test mock and unit tests covering
filename-independent codeful detection.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…pProject

The WORKFLOW_CODEFUL_ENABLED workspace setting lives in the gitignored
local.settings.json and adds no detection value alongside the authoritative
.csproj SDK-reference check, so isLogicAppProject no longer consults it. The
isCodeful UI context is now driven by the structural .csproj signal, which also
works for source-controlled projects missing local.settings.json. Adds a test
asserting a folder with only the setting (no .csproj) is not tagged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Renames the golden-content test suites and their baseline objects
(goldenHostJson/goldenRootHostJson -> expectedHostJson/expectedRootHostJson,
'golden ... content by logic app type' -> 'expected ... content by logic app type')
so the intent reads clearly without the golden-test jargon. No behavior change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lambrianmsft lambrianmsft merged commit 2180030 into Azure:main Jul 11, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-validated risk:medium Medium risk change with potential impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants